<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>223-获取表单元素.html</title>
</head>
<body>
	<form action="" id="form1">
		<input type="text" name="username">
		<input type="password" name="password">
		<input type="radio" name="sex">男	
		<input type="radio" name="sex">女
	</form>
	<form action="" id="form2"></form>
</body>
<script>
	console.log(document.forms);
	console.log(document.forms[0]);
	console.log(document.forms[0].elements);
	console.log(document.forms[0].elements[0]);
	console.log(document.forms[0].elements['username']);
	console.log(document.forms[0].elements.username);
	console.log(document.forms[0].username);
	console.log(document.forms[0].sex);
</script>
</html>